<?php
Util::tsRegisterAssetJs("ninios.js");

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('niniosCartaNutricional-grid', {
data: $(this).serialize()
});
return false;
});
");
?>
<div class="row-fluid sortable span9">
    <div class="box">
        <div class="box-header well" data-original-title>
            <h2>
<!--                <i class="icon-list"></i> -->
              <?php echo Yii::t('AweCrud.app', 'Manage') ?> <?php echo Ninios::label(2) ?> 
            </h2>
            <div class="box-icon">
                <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i> </a> 
            </div>
        </div>

        <div class="box-content">
            <?php
//$dataProvider = new NiniosCartaNutricional;
            $dataProvider = new CActiveDataProvider('NiniosCartaNutricional', array(
                'Pagination' => array(
                    'PageSize' => 50)
            ));
            $model = new NiniosCartaNutricional;
            $this->widget('bootstrap.widgets.TbGridView', array(
                'id' => 'niniosCartaNutricional-grid',
                'type' => 'striped bordered hover advance',
//    'selectableRows' => 2,
                'dataProvider' => $dataProvider,
                'filter' => $model,
                'columns' => array(
//        array(
//            'name' => 'id_niniosCartaNutricional',
//            'id' => 'check',
////            'class' => 'hidden',
//            'value' => '$data->id',
//        ),
                    array(
                        'name' => 'ninios_id',
                        'header' => 'Ninios',
                        'value' => '$data->ninios->nombres',
//            'filter' => CHtml::listData(Ninios::model()->findAll(), 'id', Ninios::representingColumn()),
                    ),
                    array(
                        'name' => 'carta_nutricional_id',
                        'header' => 'Menu',
                        'value' => '$data->cartaNutricional->nombre',
                    ),
                    array(
                        'name' => 'fecha',
                        'header' => 'Fecha',
                        'value' => '$data->fecha',
                    ),
                    array(
                        'class' => 'bootstrap.widgets.TbButtonColumn',
                        'template' => '{observaciones}',
//            'id' => '$data->id',
                        'buttons' => array(
                            'observaciones' => array(
                                'label' => '<button class="btn btn-info btn-setting">Observaciones</button>',
                                'url' => '"#modalObservaciones"',
                                'options' => array(
                                    'id' => '$data->id',
                                    'ob' => 'obs',
                                    'data-toggle' => 'modal',
                                    'title' => 'Registrar observaciones',
//                        'value' => "Observaciones",
                                ),
                                'imageUrl' => false,
//                    'click' => 'function() {crearLlamadaSaliente($(this).attr("href")); return false;}',
//                    'visible' => 'Util::checkAccess(array("action_llamada_cargarFormularioLlamadaSaliente"))'
                            ),
                        ),
                        'htmlOptions' => array(
                            'width' => '206px'
                        )
                    ),
                ),
                'ajaxUpdate' => 'child-grid',
            ));
            ?>

            <!-- Modal Observaciones-->
            <!--    <div id="modalObservaciones" class="modal hide fade"  style="display:none" aria-hidden="true">
                    <div class="modal-header">
                        <a class="close" id="" data-dismiss="modal">&times;</a>
                        <h3>Hola</h3>
                    </div>
                    <div class="modal-body" id="nivel3">
                    </div>
                </div>-->
        </div>
    </div>
</div>

<div class="modal hide fade" id="modalObservaciones">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">X</button>
        <h3>Observaciones: </h3>
    </div>
    <div class="modal-body">

    </div>
    <div class="modal-footer">
        <a id="btnCerrarModal" class="btn" data-dismiss="modal">Close</a> <a id="btnSalvar"   class="btn btn-primary">Guardar</a>
    </div>
</div>
